<!doctype html>

<html>

  <head>
    <meta charset="utf-8">
    <title>Another WASM table example</title>
  </head>

  <body>
    <script>
      const tbl = new WebAssembly.Table({
        initial: 2,
        element: "anyfunc"
      });
      console.log(tbl.length);
      console.log(tbl.get(0));
      console.log(tbl.get(1));

      const importObject = {
        js: { tbl }
      };

      WebAssembly.instantiateStreaming(fetch("table2.wasm"), importObject)
      .then(obj => {
        console.log(tbl.length);
        console.log(tbl.get(0)());
        console.log(tbl.get(1)());
      });
    </script>
  </body>

</html>
